package com.ruoyi.eqmonitor.mapper;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.eqmonitor.domain.OptDevice;
import com.ruoyi.eqmonitor.dtos.*;
import com.ruoyi.eqmonitor.dtos.CsyzSubclassDto;
import com.ruoyi.eqmonitor.vo.OptDeviceVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * @author ruoyi
 * @date 2022-11-25
 */
public interface OptDeviceMapper extends BaseMapper<OptDevice>{

    public List<OptDeviceDto> selectOptDeviceList(OptDeviceDto optDevice);

    public OptDeviceDto selectOptDeviceById(Long id);

    public OptDeviceDto selectOptDeviceByCode(String code);

    public OptDeviceDto selectOptDeviceByRealCode(String realCode);

    public List<OptDeviceQuantityCountDto> selectOptDeviceQuantity(AlarmSearchInput inputs);

    public List<OptDeviceAlarmCountDto> selectOptDeviceAlarmQuantity(AlarmSearchInput inputs);

    public List<OptDeviceDto> selectPumpStationDeviceList(@Param("deviceTypes") List<String> deviceTypes);

    public List<OptDeviceDto> selectOptDeviceListAndLastTime(OptDeviceDto optDevice);

    List<CsyzSubclassDto> myCount(@Param("deviceTypes") List<String> deviceTypes);

    public List<StreetAlarmResultDto> selectStreetAlarm(AlarmSearchInput inputs);
    public List<StreetAlarmResultDto> selectStreetSubAlarm(AlarmSearchInput inputs);

    List<OptDeviceVo> getAll(Integer state);

    public List<OptDevice> selectOptDeviceNewList(OptDevice optDevice);

    public OptDevice selectOptDeviceNewById(Long id);

    List<OptDevice> backstageDeviceSum(@Param("areaName") String areaName,
                                       @Param("deviceTypeList") List<String> deviceTypeList);

    List<Map<String, String>> mySelectCount(String areaName);
    @Select("select site_id,site_name,abx,aby from opt_device group by site_name,site_id,abx,aby")
    List<OptPointDto> selectOptPointList();
    //@Select("select device_type,device_code from opt_device where site_id = #{siteId} and sensor_type in (#{sensorStr}) group by device_type,device_code")
    List<OptDeviceDto> selectOptDeviceListBySiteId(@Param("siteId") String siteId,@Param("sensorTypeList") List<String> sensorTypeList);

    @Select("select count(1) from opt_device where sensor_type like CONCAT('%',#{s},'%')")
    int countBySensorType(String s);
}
